package com.soup.lab.spring.aop.order;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

@Aspect
@Component
@Order(1)
public class Aspect1 {

    @Before("com.soup.lab.spring.aop.CommonPointcuts.sampleTest()")
    public void beforeTest() {
        System.out.println("before test Aspect1");
    }

    @Around("com.soup.lab.spring.aop.CommonPointcuts.sampleTest()")
    public Object aroundTest(ProceedingJoinPoint joinPoint) throws Throwable {
        System.out.println("around before test Aspect1");
        Object proceed = joinPoint.proceed();
        System.out.println("around after test Aspect1");
        return proceed;
    }

    @After("com.soup.lab.spring.aop.CommonPointcuts.sampleTest()")
    public void afterTest() {
        System.out.println("after test Aspect1");
    }

    @AfterReturning("com.soup.lab.spring.aop.CommonPointcuts.sampleTest()")
    public void afterReturningTest() {
        System.out.println("after returning test Aspect1");
    }

}
